package com.qf.service.impl;

import com.qf.dao.UserMapper;
import com.qf.dto.UserDto;
import com.qf.entity.User;
import com.qf.service.UserService;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @author chen
 * @version 1.0
 * @date 2019/10/24 9:00
 */
@Service
public class UserServiceImpl implements UserService {
    @Resource
    private UserMapper userMapper;
    @Override
    public UserDto findUserByUserId(Integer userId) {
        User user = userMapper.selectByUserid(userId);
        UserDto userDto = new UserDto();
        BeanUtils.copyProperties(user, userDto);
        User loveUser = userMapper.getLoveUser(userId);
        userDto.setUser(loveUser);
        return userDto;
    }
}
